/* 
 * $Id: Mutex.cc,v 1.4 2005-12-15 07:13:30 bacon Exp $
 */

#include <xpp/bas/Mutex.h>

namespace xpp
{
	namespace bas
	{

		Mutex::Mutex () 
		{
			if (xp_mtx_open(this) == XP_NULL) {
				XPP_THROW (MutexException);
			}
		}

		Mutex::~Mutex ()
		{
			xp_mtx_close (this);
		}

		int Mutex::tryLock () 
		{
			return xp_mtx_trylock (this);
		}

		int Mutex::lock () 
		{
			return xp_mtx_lock (this);
		}

		int Mutex::unlock () 
		{
			return xp_mtx_unlock (this);
		}

	}
}
